package com.hss01248.dialog.bottomsheet;


import com.hss01248.dialog.ResourceTable;
import com.hss01248.dialog.adapter.SuperLvHolder;
import ohos.agp.components.Component;
import ohos.agp.components.Image;
import ohos.agp.components.Text;
import ohos.app.Context;

/**
 * Created by Administrator on 2016/10/19.
 */

public class BsLvHolder extends SuperLvHolder<BottomSheetBean> {
    public Image ivIcon;
    public Text mTextView;

    public BsLvHolder(Context context){
        super(context);

    }

    @Override
    protected void findViews() {
        ivIcon = (Image) rootView.findComponentById(ResourceTable.Id_iv_icon);
        mTextView = (Text) rootView.findComponentById(ResourceTable.Id_tv_msg);
    }

    @Override
    protected int setLayoutRes() {
        return ResourceTable.Layout_item_bottomsheet_lv;
    }

    @Override
    public void assingDatasAndEvents(Context context, BottomSheetBean bean) {
        if (bean.icon<=0){
            ivIcon.setVisibility(Component.HIDE);
        }else {
            ivIcon.setPixelMap(bean.icon);
            ivIcon.setVisibility(Component.VISIBLE);
        }

        mTextView.setText(bean.text);
    }
}
